package cn.jetpiece.cloud.common.app.modular.message.wrapper;

import cn.hutool.core.bean.BeanUtil;
import cn.jetpiece.cloud.common.api.message.model.result.AnnouncementResult;
import cn.jetpiece.cloud.common.api.message.model.result.AnnouncementSendResult;
import cn.jetpiece.cloud.common.app.modular.message.entity.Announcement;
import cn.jetpiece.cloud.common.app.modular.message.service.IAnnouncementService;
import cn.jetpiece.cloud.core.util.ResultWrapper;
import cn.jetpiece.cloud.model.util.SpringContextHolder;

/**
 * 用户通告阅读标记表
 *
 * @author jetpiece
 * @since 2022-11-16
 */
public class AnnouncementSendWrapper extends ResultWrapper<AnnouncementSendResult> {

    public AnnouncementSendWrapper(Object object) {
        super(object);
    }

    @Override
    protected void wrapTheDto(AnnouncementSendResult dto) {
        Announcement announcement = SpringContextHolder.getBean(IAnnouncementService.class).getById(dto.getAnnouncementId());
        if (announcement != null) {
//            dto.setAnnouncement(BeanUtil.copyProperties(announcement, AnnouncementResult.class));
        }
    }
}
